Skip to content

[SourceDB to Spanner] Fetch size Automation#3260

Draft
sm745052 wants to merge 17 commits intomainfrom
fetchSizeV2
Draft

[SourceDB to Spanner] Fetch size Automation#3260
sm745052 wants to merge 17 commits intomainfrom
fetchSizeV2

Conversation

@sm745052
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @sm745052, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the SourceDB to Spanner migration pipelines by automating the JDBC fetch size configuration. Previously, the fetch size might have been a fixed value or manually configured, potentially leading to suboptimal performance or resource issues. The new implementation dynamically calculates an appropriate fetch size by considering the Dataflow worker's machine type (CPU and memory) and the estimated size of rows being read from the source database. This automation aims to improve the efficiency and stability of data transfer, adapting to varying data characteristics and worker configurations.

Highlights

  • Automated JDBC Fetch Size Calculation: Introduces a new FetchSizeCalculator to dynamically determine the optimal JDBC fetch size for data reads, based on Dataflow worker machine type (CPU and memory) and estimated row size from the source database.
  • Enhanced Row Size Estimation: Extends the DialectAdapter and JdbcValueMappingsProvider interfaces with methods for estimating the size of a row for various database column types. Concrete implementations for MySQL and PostgreSQL are updated to provide these detailed size estimations.
  • Centralized Dataflow Worker Machine Type Utility: Replaces the previous DataflowWorkerMachineTypeValidator with a more comprehensive DataflowWorkerMachineTypeUtils. This new utility can retrieve worker memory and core information directly from the Compute Engine API, cache it for efficiency, and perform machine specification validations.
  • Seamless Integration and Refactoring: The automated fetch size calculation is integrated into the JdbcIoWrapper used by SourceDB to Spanner migration templates. This involves updating configuration classes (JdbcIOWrapperConfig, TableConfig, SourceTableSchema) and refactoring references to the new machine type utility across multiple template files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 85.80645% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.13%. Comparing base (6ae6430) to head (d88e2d2).

Files with missing lines Patch % Lines
...owmapper/provider/PostgreSQLJdbcValueMappings.java 85.39% 0 Missing and 13 partials ⚠️
.../reader/io/jdbc/iowrapper/FetchSizeCalculator.java 74.28% 7 Missing and 2 partials ⚠️
...dbc/rowmapper/provider/MysqlJdbcValueMappings.java 87.50% 0 Missing and 7 partials ⚠️
...grations/utils/DataflowWorkerMachineTypeUtils.java 89.70% 5 Missing and 2 partials ⚠️
...ud/teleport/v2/options/OptionsToConfigBuilder.java 76.19% 4 Missing and 1 partial ⚠️
...oud/teleport/v2/templates/DataStreamToSpanner.java 0.00% 1 Missing ⚠️
...cloud/teleport/v2/templates/SourceDbToSpanner.java 0.00% 1 Missing ⚠️
...cloud/teleport/v2/templates/SpannerToSourceDb.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3260      +/-   ##
============================================
+ Coverage     51.05%   51.13%   +0.08%     
- Complexity     5172     5596     +424     
============================================
  Files           978      980       +2     
  Lines         60468    60635     +167     
  Branches       6633     6670      +37     
============================================
+ Hits          30871    31008     +137     
- Misses        27431    27441      +10     
- Partials       2166     2186      +20     
Components Coverage Δ
spanner-templates 70.98% <85.80%> (+0.09%) ⬆️
spanner-import-export 69.06% <ø> (ø)
spanner-live-forward-migration 80.19% <88.40%> (+0.14%) ⬆️
spanner-live-reverse-replication 77.72% <88.40%> (+0.13%) ⬆️
spanner-bulk-migration 88.00% <86.36%> (-0.08%) ⬇️
Files with missing lines Coverage Δ
.../reader/io/jdbc/dialectadapter/DialectAdapter.java 100.00% <100.00%> (ø)
...source/reader/io/jdbc/iowrapper/JdbcIoWrapper.java 93.33% <100.00%> (+0.32%) ⬆️
.../io/jdbc/iowrapper/config/JdbcIOWrapperConfig.java 97.05% <100.00%> (+0.13%) ⬆️
...e/reader/io/jdbc/iowrapper/config/TableConfig.java 100.00% <100.00%> (ø)
.../source/reader/io/jdbc/rowmapper/JdbcMappings.java 100.00% <100.00%> (ø)
.../v2/source/reader/io/schema/SourceTableSchema.java 100.00% <ø> (ø)
...loud/teleport/v2/templates/PipelineController.java 49.33% <100.00%> (+1.03%) ⬆️
...oud/teleport/v2/templates/DataStreamToSpanner.java 19.12% <0.00%> (ø)
...cloud/teleport/v2/templates/SourceDbToSpanner.java 36.11% <0.00%> (ø)
...cloud/teleport/v2/templates/SpannerToSourceDb.java 0.00% <0.00%> (ø)
... and 5 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@VardhanThigle VardhanThigle self-requested a review February 4, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant